package main

import (
	"encoding/json"
	"log"
	"os"
)

type Config struct {
	Broker []struct {
		Host string
		Port int
	}
	Backend []struct {
		Host string
		Port int
	}
}

func main() {
	r, err := os.Open("K:/IdeaProjects/gitosc/caipus/json/config.json")
	if err != nil {
		log.Fatalln(err)
	}
	decoder := json.NewDecoder(r)
	var c Config
	err = decoder.Decode(&c)
	if err != nil {
		log.Fatalln(err)
	}
	for k, v := range c.Broker {
		log.Println(k, v.Host, v.Port)
	}
	for k, v := range c.Backend {
		log.Println(k, v.Host, v.Port)
	}
}
